//
//  CustomTwoTypeTableViewCell.m
//  ChunLaiZhuangClient
//
//  Created by zzs on 16/2/16.
//  Copyright © 2016年 CLZ. All rights reserved.
//

#import "CustomTwoTypeTableViewCell.h"
#import "CustomButtonItem.h"
@implementation CustomTwoTypeTableViewCell

- (void)awakeFromNib {
    // Initialization code
    

}
-(void)setIconModel:(Link_iconModel *)iconModel{
    _iconModel=iconModel;
    LinksModel *linkModel=iconModel.module_data;
    float widh=53;
    float distance=(SCREEN_WIDTH-widh*linkModel.links.count)/(linkModel.links.count+1);
    for (int i=0; i<linkModel.links.count; i++) {
        Link_DetailModel *detailModel=linkModel.links[i];
        CustomButtonItem *item=[[CustomButtonItem alloc] initWithFrame:CGRectMake(distance+(distance+widh)*i, 11,widh,72) norImage:@"" selectedImage:@"" titile:detailModel.name];
        item.imageView.contentMode=UIViewContentModeScaleAspectFit;
        [item sd_setImageWithURL:[NSURL URLWithString:detailModel.image] forState:UIControlStateNormal placeholderImage:nil];
        item.forHome=YES;
        [item addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];
        item.tag=i;
        [self addSubview:item];
    }
}
-(void)buttonAction:(UIButton*)bt{
    LinksModel *linksModel=_iconModel.module_data;
    Link_DetailModel *detailModel=linksModel.links[bt.tag];
    [TransferManager transferToSomeViewType:detailModel.link_type linkID:detailModel.link_id linkName:detailModel.link_name fromView:self];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
